[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
ENTER Enter Stack Frame (186/286/386) Flags: O D I T S Z A P C
ENTER #locals, nesting
Logic: push BP
temp . SP
while(nesting > 0)
nesting . nesting - 1
BP . BP - 2
push SS:[BP]
end
BP . temp
SP . SP - #locals
Note: for 386, convert all registers to extended versions, and
subtract 4 from BP each iteration.
ENTER creates a stack frame. It saves the previous stack frame
pointer BP, sets the frame to the current stack top, and allocates
space for local variables. Parameters passed to the procedure are
stored at positive offsets from BP; local variables are stored at
negative offsets from BP.
For example, ENTER n,0 (which creates a stack frame with space for n
bytes) is equal to these instructions:
PUSH BP
MOV BP, SP
SUB SP, n
If nesting of procedure definitions is allowed in the calling language
(allowed in Pascal, Modula 2, or Ada), pointers to the previous stack
frame are pushed onto the stack so that you can address variables on the
stack whose scopes are outside the current stack frame.
--------------------------------------------------------------------------
Operands Clocks Transfers Bytes Example
ENTER immediate16,0 11 (286) - 4 ENTER NUMBYTES,0
ENTER immediate16,1 15 (286) - 4 ENTER NUMBYTES,1
--------------------------------------------------------------------------
See Also:
LEAVE
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson